package org.jeecg.modules.meter.mapper;

import java.util.List;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.entity.meter.Meter;
import org.jeecg.entity.meter.MeterGateway;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.entity.meter.MeterSmsConfig;

/**
 * @Description: 仪表设备网关
 * @Author: jeecg-boot
 * @Date:   2020-11-20
 * @Version: V1.0
 */
public interface MeterGatewayMapper extends BaseMapper<MeterGateway> {
    @Select("select id,name,is_use,request_url,project_id from meter_gateway where project_id =#{projectId} and del_flag='0'")
    List<MeterGateway> queryGetWayList(@Param("projectId")String projectId);
    @Select("select count(0) from meter where meter_gateway = #{meterGateway} and meter_code = #{no} and del_flag='0'")
    Integer queryCountByWayNo(@Param("no") String no, @Param("meterGateway") String meterGateway);
    @Select("select id from meter_gateway where project_id = #{projectId} and name =#{meterGateway} and del_flag='0'")
    String queryMeterGateWayName(@Param("projectId") String projectId,@Param("meterGateway") String trim);

    @SqlParser(filter = true)
    MeterGateway getByMeterId(String meterId);
    @SqlParser(filter = true)
    MeterGateway queryById(String meterGateway);
    @Select("select count(0) from meter_sms_config where project_id =#{projectId}")
    Integer querySmsConfig(@Param("projectId") String projectId);


}
